#include <stdio.h>
#include <string.h>
#include <stdint.h>

struct msg
{	long type;
	unsigned char text;
};

extern int alarm_temp;
extern int msgid;
struct msg buf_recv;

#define SIZE (sizeof(struct msg) - sizeof(long))

/**
 *@breif:设置温度自动报警值
 *@author：马德顺
 */
void *handler_settemp(void * arg)
{
	while(1)
	{
		if(msgrcv(msgid,&buf_recv,SIZE,2,0) == -1)
		{
			perror("msgrcv err!");
			return ;
		}

		alarm_temp = (int)(buf_recv.text);
		
		printf("set temp alarm %d\n",alarm_temp);

	}

	pthread_exit("tid exit");
	
}